package com.hzjh.base.log.report

/**
 *  Default imp only log.
 *
 **/
object ErrorReporter: IErrorReporter {

    private val reporters = mutableListOf<IErrorReporter>().apply {
        add(DefaultReporter())
    }

    fun register(reporter: IErrorReporter) {
        reporters.add(reporter)
    }

    fun unRegister(reporter: IErrorReporter) {
        reporters.remove(reporter)
    }

    override fun report(msg: String) {
        reporters.forEach {
            it.report(msg)
        }
    }

    override fun report(throwable: Throwable) {
        reporters.forEach {
            it.report(throwable)
        }
    }


}